<script>
import * as echarts from 'echarts';
import {queryDailyTaskSubmitCount} from "@/api/teaching/daily_tasks"
export default {
  name: "DailyTask",
  props: {
  },
  data() {
    return {
    }
  },
  mounted() {
    if(!this.$auth.hasRoleAndExcludeSuper('student'))
    {
      return;
    }
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;
    //ajax获取数据
    queryDailyTaskSubmitCount().then(resp=>{
      option = {
        title: {
          text: '昨日班级每日任务提交汇总',
          subtext: '',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: resp.data,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
    })

  }
};


</script>

<template>
    <div id="main" style="width: 100%;height:400px;align-content: center" ></div>
</template>

<style scoped lang="scss">

</style>
